class Ruiqu::StoreFriendsController < Ruiqu::BaseController
  before_action :set_store, only: [:show, :edit, :update]

  def index
    get_search_params
    @q = current_store.friends.ransack(params[:q])
    @store_friends = @q.result
  end

  def show

  end

  def apply_list
    @store = current_store
    result = $redis.get(@store.cache_key)
    if result.present?
      @requests = eval(result)
    else
      @requests = nil
    end
  end

  private
  def set_store
    @store = Store.find(params[:id])
  end

  def get_search_params
    params[:q] ||= {}
    @search_params = params[:q][:name_or_uid_cont]
  end
end
